#ifndef _ANIMATED_SPRITE_H_
#define _ANIMATED_SPRITE_H_

#include <atlstr.h>
#include <d3d9.h>
#include <d3dx9.h>

#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")

#include "Vector3.h"
#include "Sprite.h"

#pragma once

class VAnimatedSprite : public VSprite
{
public:
	VAnimatedSprite(void);
	VAnimatedSprite(CString strSpriteName);
	~VAnimatedSprite(void);

	void SetDrawSize(int nWidth, int nHeight);		//Set the sprite size
	void SetDrawStart(int nStartX, int nStartY);

	int  GetMaximumAnimation();						//Get the animation maximum amount
	void SetMaximumAnimation(int nAnimSize);		//Set the animation maximum amount

	int  GetCurrentAnimation();						//Get current animation
	void SetCurrentAnimation(int nAnimCurrent);		//Set the current animation

	void SetMaximumTime(int nTimeMax);				//Set the maximum of time before next sprite
	void SetCurrentTime(int nTimeCurrent);			//Why do I need this? Set the current time before next sprite
//{{AFX_VIRTUAL(VAnimatedSprite)
	virtual void Draw();
	virtual void Release();
//}}AFX_VIRTUAL
	void SetRunRepeat();
	void SetRunOnce();
	void StopAnimation();
	void StartAnimation();
	void RestartAnimation();

private:
	// sprite declarations
	LPDIRECT3DTEXTURE9	m_sprite;		// the pointer to the sprite

	int				m_nWidth;
	int				m_nHeight;
	int				m_nStartX;
	int				m_nStartY;

	int					m_nMaximumAnim;	//Update Animation
	int					m_nCurrentAnim;
	int					m_nMaximumTime;	//Update Frequency
	int					m_nCurrentTime;
	BOOL				m_bRepeat;		//Is animation loop or not?
	BOOL				m_bRunning;		//Is animation run or stop?
};

#endif